import request from '@/utils/request'

export function getDownload (url, parameter, headers) {
  return request({
    url: url,
    responseType: 'blob',
    method: 'get',
    headers: headers,
    params: parameter
  })
}
export function getDataByParameter (url, parameter, headers) {
  return request({
    url: url,
    method: 'get',
    headers: headers,
    params: parameter
  })
}


export function getCountByParameter (url, parameter, headers) {
  return request({
    url: url + parameter,
    method: 'get',
    headers: headers
  })
}

export function getObjetInfoByPid (url, parameter, headers) {
  return request({
    url: url + '/' + parameter,
    headers: headers,
    method: 'get'
  })
}

// parameter.sysSeq == 0 add     post
// parameter.sysSeq != 0 update  put
export function saveObjetInfo (url, parameter, headers) {
  return request({
    url: url,
    method: (!parameter.sysSeq) || (parameter.sysSeq === 0) ? 'post' : 'put',
    headers: headers,
    data: parameter
  })
}

// post
export function postInfo (url, parameter, headers) {
  return request({
    url: url,
    method: 'post',
    headers: headers,
    data: parameter
  })
}

// parameter.sysSeq != 0 delete  delete
export function deleteObjetInfo (url, parameter, headers) {
  return request({
    url: url,
    method: 'DELETE',
    headers: headers,
    data: parameter
  })
}
